/*!
 * \file MediaLibrary.h
 * \brief Database like object which keeps track of media available for transmission
 */

#ifndef TSC_MEDIA_LIBRARY_H
#define TSC_MEDIA_LIBRARY_H

#include "list"
#include "UAP.pb.h"

namespace tsc
{
namespace common
{

/**
 * Library of media items available for transmission
 */
class MediaLibrary
{
public:

    static const uint32_t INVALID_MEDIA_ITEM_ID;

	/**
	 * Returns singleton instance of this class
	 * \return instance of media library
	 */
	static MediaLibrary& instance();

	/**
	 * Returns list of available media items matching specified capabilities
	 * Caller of this function is responsible for deleting the list
	 */
	std::list<ProtocolsCommon::PlayableItem*>*
	getAvailableMedia(UserApplicationPart::ClientCapabilities* capabilities);

	/**
	 * Checks whether specified media item matches set of user capabilities
	 *
	 * \param item media item to check
	 * \param cap UserClient's capabilities to check against
	 */
	bool isMatching(ProtocolsCommon::PlayableItem* item,
					UserApplicationPart::ClientCapabilities* cap);

	/**
	 * Checks if media with specified item exists in library
	 * \param mediaItemId ID of the media item to check
	 * \return <code>true</code> if found, <code>false</code> otherwise
	 */
	bool itemExists(uint32_t mediaItemId);

private:
	/**
	 * Creates the library object
	 */
	MediaLibrary();

	/**
	 * Destructor
	 */
	~MediaLibrary();


	std::list<ProtocolsCommon::PlayableItem*> mMediaItems;
};

} // namespace common
} // namespace tsc

#endif // TSC_MEDIA_LIBRARY_H
